<?php
/**
 * Created by PhpStorm.
 * User: zjw
 * Date: 2018/3/8
 * Time: 下午6:46
 */
use yii\grid\GridView;
use yii\helpers\Html;
use yii\widgets\ActiveForm;

?>
<div class="article-index">
    <?php $form = ActiveForm::begin([
        'method' => 'get',
    ]); ?>
    <?= $form->field($model, 'phone')->textInput()->label("手机号") ?>
    <div id="search-option">
        <?= Html::submitButton('搜索', ['class' => 'btn btn-primary center']) ?>
    </div>
    <?php ActiveForm::end(); ?>
<div class="article-index">
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
            'customer_id',
            'open_id',
            'phone',
            'status',
            [
                'attribute' => 'nickname',
                'value' => function ($model) {
                    return urldecode($model->nickname);
                }
            ],
            [
                'label' => '头像',
                'format' => [
                    'image',
                    [
                        'width' => '84',
                        'height' => '84'
                    ]
                ],
                'value' => function ($model) {
                    return $model->avatar;
                }
            ],
            [
                'attribute' => 'created_at',
                'value' => function ($model) {
                    return date("Y-m-d H:i:s", $model->created_at);
                }
            ],
            [
                'attribute' => 'updated_at',
                'value' => function ($model) {
                    return date("Y-m-d H:i:s", $model->updated_at);
                }
            ],
            ['class' => 'yii\grid\ActionColumn',
                'template' => '{delete} {url}'
            ],
        ],
    ]); ?>
</div>
